<!--
 * @LastEditors: Darth_Eternalfaith
-->
<!--
 * @LastEditors: Darth_Eternalfaith
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>身份证校验码生成器</title>
</head>
<body>
    自行上网搜索地区码和自己输入生日等信息以得到前17位
    <input type="text" name="" id="cnm">
    <div id="rr"></div>
    <script>
        var cnm=document.getElementById("cnm");
        var rr=document.getElementById("rr");
        var ek=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];
        cnm.oninput=function(e){            
            if(this.value.length>=17){
                var d=this.value;
                var r=0;
                for(var i =ek.length-1;i>=0;--i){
                    r+=ek[i]*d[i];
                }
                rr.innerText=(12-r%11)%11;
            }
        }   
    </script>
</body>
</html>